import time
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By


service = Service(executable_path="E:\python\python38\chromedriver.exe")
driver = webdriver.Chrome(service=service)
driver.get("http://121.43.169.97:8848/pageA.html")
driver.maximize_window()
#获取用户框的大小
size=driver.find_element(By.CSS_SELECTOR,"#userA").size
print("用户输入框的大小为",size)
#获取第一个链接
text=driver.find_element(By.CSS_SELECTOR,"a").text
print("链接为",text)
#获取第一个超链接地址
href=driver.find_element(By.CSS_SELECTOR,"a").get_attribute("href")
print("超链接为",href)
#判断span是否可见
span=driver.find_element(By.CSS_SELECTOR,"span").is_displayed()
print(span)
#判断取消按钮是否可用
cance=driver.find_element(By.CSS_SELECTOR,"#cancelA").is_enabled()
print(cance)
#判断页面中'旅游'对应的复选框是否为选中的状态
lya=driver.find_element(By.CSS_SELECTOR,"#lyA").is_selected()
print(lya)

yya=driver.find_element(By.CSS_SELECTOR,"#yyA").is_selected()
print(yya)
time.sleep(3)
driver.quit()